package com.lovo.Atm;

import com.lovo.Util;

import javax.swing.*;
import java.awt.*;


public class Home extends JFrame {
    private Land landPanel = new Land(this);
    private Menu menuPanel = new Menu(this);
    private Get getPanel = new Get(this);
    private Save savePanel = new Save(this);
    private Find findPanel = new Find(this);
    private CardLayout cardLayout = new CardLayout();

    private Image bg = Util.image("/images/background.jpg");

    public Home(){
        this.setContentPane(new JPanel(){
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(bg,0,0,1024,768,this);
            }
        });

        this.setLayout(cardLayout);

        this.add("land",landPanel);
        this.add("menu",menuPanel);
        this.add("get",getPanel);
        this.add("save",savePanel);
        this.add("find",findPanel);


        this.setSize(1024,768);
        this.setLocationRelativeTo(null);
        this.setTitle("ATM");
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setVisible(true);


    }

    public void switchPanel(String name){
        cardLayout.show(this.getContentPane(),name);
    }

    public static void main(String[] args) {
        new Home();
    }
}
